<!--  -->
<template>
  <div class="search">
    <el-form :inline="true" :model="formInline" size="medium">
      <el-form-item label="工单编号:">
        <el-input v-model="formInline.taskCode" placeholder="请输入" />
      </el-form-item>
      <el-form-item label="工单状态:">
        <el-select v-model="formInline.status" placeholder="请选择">
          <el-option v-for="item in state" :key="item.statusId" :label="item.statusName" :value="item.statusName" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button size="small" style="background-color:#5f84ff" type="primary" class="iconfont icon-sousuo" @click="onSubmit"> 查询</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  props: {
    state: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      formInline: {
      },
      search: {
      }
    }
  },
  methods: {
    onSubmit() {
      this.search = {
        taskCode: this.formInline.taskCode,
        pageIndex: 1,
        pageSize: 10,
        isRepair: false
      }
      // 1:待办;2:进行;3:取消;4:完成
      if (this.formInline.status === '待办') {
        this.search.status = 1
      } else if (this.formInline.status === '进行') {
        this.search.status = 2
      } else if (this.formInline.status === '取消') {
        this.search.status = 3
      } else if (this.formInline.status === '完成') {
        this.search.status = 4
      }
      this.$emit('onSubmit', this.search)
    }
  }
}

</script>
<style lang='scss' scoped>
.search {
  display: flex;
  align-items: center;
  height: 64px;
  background-color: #fff;
  padding: 20px 0 0 20px;
  margin-bottom: 20px;
}
</style>
